package cn.zlb.frame.domain.merchant.model.valueObj;

import cn.zlb.frame.common.enums.IBaseEnum;

/**
 * @author yangjie.deng@resico.cn
 * @date 2023-11-09 13:34:11
 * @describe class responsibility
 */
public enum PayTypeValueObj implements IBaseEnum {
    // 1- 微信 2- 支付宝 3- 银行卡 4- 云闪付
    WECHAT_PAY(1, "微信支付"),
    ALI_PAY(2, "支付宝"),
    BANK_CARD_PAY(3, "银行卡支付"),
    YUN_FLASH_PAY(4, "云闪付")
    ;

    private final int value;
    private final String name;

    PayTypeValueObj(int value, String name) {
        this.value = value;
        this.name = name;
    }

    @Override
    public String getName() {
        return this.name;
    }

    @Override
    public Integer getValue() {
        return this.value;
    }

    public static PayTypeValueObj findValue(int value) {
        for (PayTypeValueObj obj : values()) {
            if (obj.getValue() == value) {
                return obj;
            }
        }
        throw new RuntimeException("未找到[" + value + "]对应支付类型.");
    }
}
